<?php

//登录类

class Login extends User{
	//创建一个构造方法来接收表单的值
	public function __construct($_userName,$_passWord){
        $this->_username = $_userName;
        $this->_password =  $_passWord;
	}
	//从xml里读取信息
	public function _query(){
		//载入xml
		$_sxe = simplexml_load_file('user.xml');
        $_sxe ->username;
        $_sxe ->password;

        //做个判断，假如接收的值跟xml的值一致，允许登录
        if($this->_username == $_sxe ->username && $this->_password == $_sxe ->password){
        	//生成cookies
        	setcookie('user',$this->_username);
        	
            Tool::_alerLocation($this->_username.',欢迎您回来','?index=member');  //登录成功进入个人中心页面    
        }else{
        	Tool::_alertBack('登录失败');
        }
	}

	public function _check(){
		//登录信息不能为空即可
		if(empty($this->_username) || empty($this->_password)){
		    return false;
		}

		return true;
		
	}
}
